#ifndef __TAB_CONF_H__
#define __TAB_CONF_H__ 1

#include <QObject>
#include <QWidget>
#include <QVBoxLayout>
#include <QAbstractItemModel>

#include "properties_model.h"
#include "extended_tree_view.h"

class CTabConf : public QWidget
{
	Q_OBJECT

public:

	CTabConf(CPropertiesModel* pModel, QWidget* pParent = NULL);
	virtual ~CTabConf();

	void loadFromFile(const QString& pFilename);
	void saveToFile(const QString& pFilename);

	void configRequested();
	void startRequested();
	void clientDisconnected();
	void sendConfigRequested(CClientConnection* pConnection);

private slots:
	void contextMenuRequested(const QPoint& pPoint);
	void newSectionRequested();
	void newKeyRequested();
	void deleteRequested();
	void dataChanged(const QModelIndex& pTopLeft, const QModelIndex& pBottomRight);
	void treeExpanded(const QModelIndex& pIndex);
	void treeCollapsed(const QModelIndex& pIndex);
	void modelSorted();
	void configReceivedEnd();

private:
	CTabConf(const CTabConf& );
	CTabConf& operator=(const CTabConf& );

	CPropertiesModel* mModel;
	QVBoxLayout mLayout;
	CExtendedTreeView mSrvConfigTree;

	quint32 mSectionCnt;

	void setupUiElements();
	void setupActions();
};

#endif /* __TAB_LOGGING_H__ */


